<?php
class Login extends Doctrine_Record {
    public function setTableDefinition() {
        $this->setTableName('login');
        $this->hasColumn('fecha','date');
    }
    
    public static function intentosDeHoy () {
        $q = Doctrine_Query::create()
            ->select('COUNT(l.fecha) as total')
            ->from('login l')
            ->where('l.fecha = "'.date('Y-m-d').'"');
        $total = $q->execute();
        return ($total->count())?$total[0]->total:0;
    }
}
?>